
package physiqueEngine.formes;

import java.awt.geom.Ellipse2D;
import java.awt.geom.Line2D;

import physiqueEngine.WorldPanel;
import physiqueEngine.bigMath.Geometry;

/**
 * @author Jean-Simon Garneau
 * @author David Bernard
 * 
 */
public class Oval extends PhysBody
{
    public static final int SHAPE_ID = 0;

    public Oval(WorldPanel parent)
    {
        super(parent, new Ellipse2D.Double());
    }

    @Override
    public int getShapeId()
    {
        return Oval.SHAPE_ID;
    }


    @Override
    public void resolveCollision(PhysBody body)
    {
        if (body.getShapeId() == Oval.SHAPE_ID)
        {
            Line2D.Double betweenLine = Physic.getNormal(this, body);
            double distance = Geometry.caclPyth(betweenLine);
            
            // Marche pour les cercle pur seulement
            if (((this.DIM.getHeight() / 2) + body.DIM.getHeight() / 2) > distance)
            {
                System.out.println("Collision");
            }
            
        }
    }
}
